﻿using Basic.FormDAL;

namespace Basic.FormCollect.lmpl
{
    internal class UserFormItemCollect : IUserFormItemCollect
    {
        private readonly IUserFormItemDAL _BasicDAL;

        public UserFormItemCollect ( IUserFormItemDAL basicDAL )
        {
            this._BasicDAL = basicDAL;
        }

        public Result[] Gets<Result> ( long recordId ) where Result : class, new()
        {
            return this._BasicDAL.Gets<Result>(a => a.RecordId == recordId);
        }

        public void Clear ( long recordId )
        {
            this._BasicDAL.Clear(recordId);
        }

        public Result[] Find<Result> ( long id, long columnId ) where Result : class, new()
        {
            return this._BasicDAL.Gets<Result>(a => a.RecordId == id && a.ColumnId == columnId);
        }

        public Result[] Finds<Result> ( long id, long[] columnId ) where Result : class, new()
        {
            return this._BasicDAL.Gets<Result>(a => a.RecordId == id && columnId.Contains(a.ColumnId));
        }
    }
}
